<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
	<%@ include file="../../include/head.jsp"%>
	<%@ include file="../../include/layui.jsp"%>
	<title>编辑${description}</title>
</head>
<body>
<div class="layui-fluid">
	<div class="layui-card">
		<div class="layui-card-body">
			<form class="layui-form" action="">
				${formEdit}
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button type="button" class="layui-btn" lay-submit  lay-filter="${nameLower}Submit" id="submitBtn">提交</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>

<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script type="text/javascript">
    layui.use(['form', 'layer', 'laydate'], function(){
        var laydate = layui.laydate;
        ${dateFormInput}

        // 校验初始化
        var form = layui.form;
        form.verify({
            ${formVerify}
        });


        form.on('submit(${nameLower}Submit)', function(){
            var url = '${ctx}/${module}/${nameLower}/';
            if($('#${pk}').val()){
                url += 'modify';
            }else{
                url += 'add';
			}
            $.post(url, $('form').serialize(), function(result){
                if(result.code == 0){
                    parent.layer.alert('操作成功', {
                        yes: function(index){
                            parent.layer.close(index);
                            closeCurrentTabsPage();
                        }
                    });
                }else{
                    parent.layer.msg(result.msg || '操作失败');
                }
            }, 'json');
            return false;
        });
    });
</script>
</body>
</html>